import '../item_style.dart';
import '../line_style.dart';
import '../tooltip.dart';
import 'series.dart';

import 'package:json_annotation/json_annotation.dart';

part 'tree_series.g.dart';

@JsonSerializable(includeIfNull: false, explicitToJson: true)
class TreeEmphasis {
  var focus;
  var blurScope;
  ItemStyle? itemStyle;
  LineStyle? lineStyle;
  SeriesLabel? label;

  TreeEmphasis(
      {this.focus, this.blurScope, this.itemStyle, this.lineStyle, this.label});

  factory TreeEmphasis.fromJson(Map<String, dynamic> json) =>
      _$TreeEmphasisFromJson(json);

  Map<String, dynamic> toJson() => _$TreeEmphasisToJson(this);
}

@JsonSerializable(includeIfNull: false, explicitToJson: true)
class TreeBlurSelectEmphasis {
  ItemStyle? itemStyle;
  LineStyle? lineStyle;
  SeriesLabel? label;

  TreeBlurSelectEmphasis({this.itemStyle, this.lineStyle, this.label});

  factory TreeBlurSelectEmphasis.fromJson(Map<String, dynamic> json) =>
      _$TreeBlurSelectEmphasisFromJson(json);

  Map<String, dynamic> toJson() => _$TreeBlurSelectEmphasisToJson(this);
}

@JsonSerializable(includeIfNull: false, explicitToJson: true)
class TreeLeaves {
  SeriesLabel? label;
  ItemStyle? itemStyle;
  TreeBlurSelectEmphasis? emphasis;
  TreeBlurSelectEmphasis? blur;
  TreeBlurSelectEmphasis? select;

  TreeLeaves(
      {this.label, this.itemStyle, this.emphasis, this.blur, this.select});

  factory TreeLeaves.fromJson(Map<String, dynamic> json) =>
      _$TreeLeavesFromJson(json);

  Map<String, dynamic> toJson() => _$TreeLeavesToJson(this);
}

@JsonSerializable(includeIfNull: false, explicitToJson: true)
class TreeData {
  var name;
  var value;
  ItemStyle? itemStyle;
  LineStyle? lineStyle;
  SeriesLabel? label;
  TreeBlurSelectEmphasis? emphasis;
  TreeBlurSelectEmphasis? blur;
  TreeBlurSelectEmphasis? select;
  Tooltip? tooltip;

  TreeData(
      {this.name,
      this.value,
      this.itemStyle,
      this.lineStyle,
      this.label,
      this.emphasis,
      this.blur,
      this.select,
      this.tooltip});

  factory TreeData.fromJson(Map<String, dynamic> json) =>
      _$TreeDataFromJson(json);

  Map<String, dynamic> toJson() => _$TreeDataToJson(this);
}

@JsonSerializable(includeIfNull: false, explicitToJson: true)
class TreeSeries {
  var id;
  var type = 'tree';
  var name;
  var zlvel;
  var z;
  var left;
  var top;
  var right;
  var bottom;
  var width;
  var height;
  var layout;
  var orient;
  var symbol;
  var symbolSize;
  var symbolRotate;
  var symbolKeepAspect;
  var symbolOffset;
  var edgeShape;
  var edgeForkPosition;
  var roam;
  var expandAndCollapse;
  var initialTreeDepth;
  ItemStyle? itemStyle;
  SeriesLabel? label;
  LabelLayout? labelLayout;
  LineStyle? lineStyle;
  TreeEmphasis? emphasis;
  TreeBlurSelectEmphasis? blur;
  TreeBlurSelectEmphasis? select;
  var selectedMode;
  TreeLeaves? leaves;
  List<TreeData>? data;
  Tooltip? tooltip;

  TreeSeries(
      {this.id,
      this.name,
      this.zlvel,
      this.z,
      this.left,
      this.top,
      this.right,
      this.bottom,
      this.width,
      this.height,
      this.layout,
      this.orient,
      this.symbol,
      this.symbolSize,
      this.symbolRotate,
      this.symbolKeepAspect,
      this.symbolOffset,
      this.edgeShape,
      this.edgeForkPosition,
      this.roam,
      this.expandAndCollapse,
      this.initialTreeDepth,
      this.itemStyle,
      this.label,
      this.labelLayout,
      this.lineStyle,
      this.emphasis,
      this.blur,
      this.select,
      this.selectedMode,
      this.leaves,
      this.data,
      this.tooltip});

  factory TreeSeries.fromJson(Map<String, dynamic> json) =>
      _$TreeSeriesFromJson(json);

  Map<String, dynamic> toJson() => _$TreeSeriesToJson(this);
}
